package com.zc.app.sys.service;

import com.github.pagehelper.PageHelper;
import com.zc.app.sys.dao.mapper.SystemUserRolePeerMapper;
import com.zc.app.sys.dao.peer.SystemUserRolePeer;
import com.zc.framework.common.bean.MyPageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by zc on 2016/11/23.
 */
@Service
public class SystemUserRoleService {

    @Autowired
    private SystemUserRolePeerMapper systemUserRolePeerMapper;

    public int createUserRole(SystemUserRolePeer userRolePeer){
        return systemUserRolePeerMapper.insert(userRolePeer);
    }

    public List<SystemUserRolePeer> selectRoleListByAccountId(Integer accountId) {
        return systemUserRolePeerMapper.selectRoleListByAccountId(accountId);
    }

    public MyPageInfo<SystemUserRolePeer> queryPages(SystemUserRolePeer userRolePeer, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return new MyPageInfo<SystemUserRolePeer>(systemUserRolePeerMapper.getUserRoles(userRolePeer));
    }

    public SystemUserRolePeer selectByPrimaryKey(Integer userRoleId) {
        return systemUserRolePeerMapper.selectByPrimaryKey(userRoleId);
    }

    public int updateByPrimaryKey(SystemUserRolePeer record) {
        return systemUserRolePeerMapper.updateByPrimaryKey(record);
    }



}
